import axios from '@/libs/axios1'
import axios_unxss from "../libs/axios_unxss";
let jsonHeaders = {'content-type': 'application/json;charset=UTF-8'}
//图片上传
export const imageUpload = params =>{
  return axios({
    url:`/identity/account/avatar`,
    method:'POST',
    headers:jsonHeaders,
    data:params
  })
}
//修改密码
export const modifyPWD = params =>{

	return axios_unxss({
		url:`/identity/account/password`,
		method:'PUT',
    	headers:jsonHeaders,
    	data:params
	})
}
//修改邮箱
export const modifyEmail = params =>{
	return axios({
		url:`/identity/account/email`,
		method:'PUT',
    	headers:jsonHeaders,
    	data:params
	})
}
//修改昵称
export const modifyNickname = params =>{
	return axios({
		url:`/identity/account/info`,
		method:'PUT',
    headers:jsonHeaders,
    data:params
	})
}
//获取课程资源统计
export const getMyResourceTotal = params => {
  return axios({
    url: `/edu-mycourse/statistics?userId=${params}`,
    method: 'get',
    headers: jsonHeaders
  })
}
//获取资源列表
export const getMyResourceList = params => {
	return axios({
    url: `/edu-mycourse/expRes/getExpUse/${params}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//查询课件用户组
export const queryExperGroups = params => {
  return axios({
    url: `/identity/experimenterGroups`,
    method: 'get',
    headers: jsonHeaders,
    params:params
  })
}

//添加试验组
export const addexpgroup = params =>{
  return axios({
    url:`/identity/experimenterGroups`,
    method:'POST',
    headers:jsonHeaders,
    data:params
  })
}

// 解散课件用户组
export const delexpgroup = id =>{
  return axios({
    url:`/identity/experimenterGroups/${id}`,
    method:'DELETE',
    headers:jsonHeaders
  })
}

//获取试验用户组详情
export const getexpgroupinfo = id =>{
  return axios({
    url:`/identity/experimenterGroups/${id}`,
    method:'GET',
    headers:jsonHeaders
  })
}

//修改试验用户组
export const regetexpgroup = (id,params) =>{
  return axios({
    url:`/identity/experimenterGroups/${id}`,
    method:'PUT',
    headers:jsonHeaders,
    data:params
  })
}

//加入课件用户组
export const applyExperGroups = params => {
  return axios({
    url: `/identity/experimenterGroups/${params.groupId}/apply`,
    method: 'post',
    params:{
    	token:params.token
    },
    headers: jsonHeaders
  })
}

//获取组详情
export const getExperGroupsInfo = params => {
  return axios({
    url: `/identity/experimenterGroups/${params}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//获取组成员
export const getExperGroupsUsers= params => {
  return axios({
    url: `/identity/experimenterGroups/${params}/users`,
    method: 'get',
    headers: jsonHeaders
  })
}

//查询单位成员
export const queryCompanyUsers= params => {
  return axios({
    url: `/identity/company/users`,
    method: 'get',
    params:params,
    headers: jsonHeaders
  })
}

//删除单位成员
export const delCompanyUsers= userId => {
  return axios({
    url: `/identity/company/users/${userId}`,
    method: 'delete',
    headers: jsonHeaders
  })
}

//获取用户信息
export const getCompanyUsersInfo= userId => {
  return axios({
    url: `/identity/company/users/${userId}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//验证用户名是否重复
export const validateUsername= username => {
  return axios({
    url: `/identity/anonymity/assess/username?username=${username}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//创建试验员
export const createUser = (groupId,userInfo) => {
  return axios({
    url: `/identity/company/users?experimenterGroupId`+ groupId,
    method: 'post',
    headers: jsonHeaders,
    data:userInfo,
    params:{
      experimenterGroupId:groupId
    }
  })
}

// 获取操作员的角色接口
export const getAllRoleData = (params) => {
    return axios({
        url: `/identity/company/userRole/page`,
        method: 'get',
        params: params,
        headers: jsonHeaders,
    })
}



//查询接入用户组信息
export const queryaccessgrouplist= params => {
  return axios({
    url: `/topo-edit/project_access_groups?memberUserId=`+params,
    method: 'get',
    headers: jsonHeaders
  })
}

//申请加入接入用户组
export const applyaccessgroup = params => {
  return axios({
    url: `/topo-edit/invites/${params.token}/apply`,
    method: 'post',
    headers: jsonHeaders
  })
}

//查询接入组详情
export const queryaccessgroupinfo = params => {
  return axios({
    url: `/topo-edit/project_access_groups/${params}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//查询接入组成员
export const getaccessgroupsusers= params => {
  return axios({
    url: `/topo-edit/project_access_members`,
    method: 'get',
    headers: jsonHeaders,
    params:params
  })
}

//查询工程接入组邀请码相关信息
export const getcodeinfo= params => {
  return axios({
    url: `/topo-edit/invites/${params}`,
    method: 'get',
    headers: jsonHeaders
  })
}

//申请加入单位
export const applycompany = params => {
  return axios({
    url: `/identity/company/apply`,
    method: 'post',
    headers: jsonHeaders,
    params:params
  })
}

// 获取当前用户信息
export const getuserinfo = params => {
  return axios({
    url: `/identity/account/info`,
    method: 'get',
    headers: jsonHeaders
  })
}